basic configuration

Brightcells 8 years ago
commit
bae4176e0c
7 changed files with 63 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 8 0
      .isort.cfg
  3. 9 0
      check.sh
  4. 3 0
      isort.sh
  5. 32 0
      main.py
  6. 9 0
      pep8.sh
  7. 1 0
      requirements.txt

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
1
+.idea/

+ 8 - 0
.isort.cfg

@@ -0,0 +1,8 @@
1
+# See the menu of settings available here:
2
+#   https://github.com/timothycrosley/isort/wiki/isort-Settings
3
+
4
+[settings]
5
+indent='    '
6
+line_length=120
7
+lines_after_imports=2
8
+skip=migrations

+ 9 - 0
check.sh

@@ -0,0 +1,9 @@
1
+#!/bin/bash
2
+
3
+echo '>> iSort'
4
+./isort.sh
5
+echo
6
+
7
+echo '>> PEP8'
8
+./pep8.sh
9
+echo

+ 3 - 0
isort.sh

@@ -0,0 +1,3 @@
1
+#!/bin/bash
2
+
3
+isort -rc -sp . .

+ 32 - 0
main.py

@@ -0,0 +1,32 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from tornado.httpserver import HTTPServer
4
+from tornado.ioloop import IOLoop
5
+from tornado.options import define, options
6
+from tornado.web import Application, RequestHandler
7
+
8
+
9
+define('host', default='127.0.0.1', help='run on the given host', type=str)
10
+define('port', default=8001, help='run on the given port', type=int)
11
+options.parse_command_line()
12
+
13
+
14
+class HelloHandler(RequestHandler):
15
+    def get(self):
16
+        self.write('Hello Tornado')
17
+
18
+
19
+handlers = [
20
+    (r'/', HelloHandler)
21
+]
22
+
23
+
24
+def main():
25
+    app = Application(handlers=handlers, default_host=options.host)
26
+    server = HTTPServer(app)
27
+    server.listen(options.port)
28
+    IOLoop.current().start()
29
+
30
+
31
+if __name__ == '__main__':
32
+    main()

+ 9 - 0
pep8.sh

@@ -0,0 +1,9 @@
1
+#!/bin/bash
2
+
3
+# Ignoring autogenerated files
4
+#  -- Migration directories
5
+# Ignoring error codes
6
+#  -- E128 continuation line under-indented for visual indent
7
+#  -- E501 line too long
8
+
9
+pep8 --exclude=migrations --ignore=E128,E501 .

+ 1 - 0
requirements.txt

@@ -0,0 +1 @@
1
+tornado==4.3